<!-- 设备缺陷记录 entity.jsp -->
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<% //String bdzname = (String) request.getParameter("bdzname");
//bdzname=bdzname.substring(0,bdzname.length()-1);
%>
<html>
	<head>
		<script type="text/javascript" src="<%=contextPath%>/js/jquery-1.3.2.min.js"></script> 
		<script type="text/javascript" src="<%=contextPath%>/js/validator.js"></script> 
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		
		<script type="text/javascript" language="javascript">  
			
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				        {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:toCheck,
				            hidden:<%=session.getAttribute("btn_save_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '送已消除',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:pass,
				            hidden:<%=session.getAttribute("btn_pass_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '归档',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:pass,
				            hidden:<%=session.getAttribute("btn_history_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '驳回',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:reject,
				            hidden:<%=session.getAttribute("btn_rejcet_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '撤销验证',
				            icon:"<%=contextPath%>/images/shuax.gif",
				            handler:function() {	
		    		 		
		    		document.getElementById("entity.xcrname").datatype="";
		    		
		    		document.getElementById("entity.xcsj").datatype="";
		    		 
		    		document.getElementById("entity.xcyy").min="0";
		    	
		    		document.getElementById("entity.ysrname").datatype="";
		    		document.getElementById("entity.dyfxrname").datatype="";
				            },
				            hidden:'${entity.id}' == '0'? true:false
				        },
				        {
				            text: '返回',
				            icon:"<%=contextPath%>/images/fanhui.png",
				            handler:function(){
				            
				            	if ('${searchBean.con19}' != 'search') {
				            		back();
				            	} else {
     								document.frmM.action = "<%=contextPath%>/zbjlSearchList!getList.do";
     								document.frmM.submit();
				            	}
				            }
				        }
			    	]
			    });
			});
		
			function toCheck(){

			  	if(!Validator.Validate(frmM,2)){
				  return false;
			  	}
          if (document.getElementById("entity.id").value != "0") {
		    	Ext.Ajax.request( {
					method :'POST',
					url :'sbqxjl!sbqxFileCountCheck.do?id='+ document.getElementById("entity.id").value,
					success : function(response) {
        				
						var obj = Ext.decode(response.responseText);
						if (obj["count"] == "0") {
							Ext.MessageBox.alert('提示', "还没有上传缺陷照片不能保存！");
							return;
						} else {
							//document.frmM.action = "<%=contextPath%>/jjb!jjb.do";
     						//document.frmM.submit();
     						comt();
						}
					},
					failure : function() {
						alert("异步失败");
					}
				});
				}else{
  				comt();
  				}
		    }   
  // 修改进入增加第二个环节的验证 by wangtao add20110115
		    function setEndCheck() {

		    	if (document.getElementById("entity.id").value != "0") {
		    	Ext.Ajax.request( {
					method :'POST',
					url :'sbqxjl!sbqxFileCountCheck.do?id='+ document.getElementById("entity.id").value,
					success : function(response) {
        				
						var obj = Ext.decode(response.responseText);
						if (obj["count"] == "0") {
							Ext.MessageBox.alert('提示', "请上传缺陷照片！");
							return;
						} else {
							//document.frmM.action = "<%=contextPath%>/jjb!jjb.do";
     						//document.frmM.submit();
						}
					},
					failure : function() {
						alert("异步失败");
					}
				});
				document.getElementById("entity.dyfxrname").datatype="Require";
     if (document.getElementById("entity.dyfxrname").value != "") {
		    		 // 
		    		document.getElementById("entity.xcrname").datatype="Require";
		    		 // 
		    		document.getElementById("entity.xcsj").datatype="Require";
		    		// 
		    		document.getElementById("entity.xcyy").min="1";
		    		// 
		    		document.getElementById("entity.ysrname").datatype="Require";
		    		}
		    		
		    	}
		    }

		 </script>  
	</head>
	<body onload="javascript:setEndCheck()">
		<div id ='tbar'></div>
		<br>
		<div id="Layer" style="position:absolute;display:block left:0px; top:35px; width:100%; height:94%; z-index:1000; overflow:auto;">
		
		<!-- 信息提示 -->
		<div id="result" align="center"><font color="red">${info }</font></div>
		<table width="100%" height="30">
			<tr>
				<td colspan="4" align="center">
					设备缺陷记录
				</td>
			</tr>
		</table>
		<form id="frmM" name="frmM" method="POST" action="<%=contextPath%>/entity!save.do">
		<input type="hidden" name="searchBean.con15" value="${entity.id}"/>
		<input type="hidden" name="searchBean.con1" value="${searchBean.con1}"/>
			<s:hidden name="entity.id" />
			<s:hidden name="entity.state" />
			<s:hidden name="entity.bdz"/>
			<s:hidden name="entity.hbr"/>
			<s:hidden name="entity.xqbz"/>
			<s:hidden name="entity.jsr"/>
			<s:hidden name="entity.xcr"/>
			<s:hidden name="entity.ysr"/>
			<s:hidden name="entity.xqcy"/>
			<s:hidden name="entity.dwry"/>
			<s:hidden name="entity.ouid"/>
			<s:hidden name ="entity.dyfxr"/>
			<s:hidden name ="entity.sbzp" msg="缺陷照片必须上传。"/>
			<table width="100%" id="infotab">
				<tr>
					<th width="120" >
						缺陷编号：
					</th>
					<td nowrap>
						<input type="text" maxlength="25" style="width:50%" name="entity.qxbh" value="${entity.qxbh}" msg="缺陷编号必须输入。" />
					</td>
					<th width="120" nowrap>
						<font color="red"></font>&nbsp;缺陷位置：
					</th>
					<td colspan="1">
						<input type="text"  style="width:50%" name="entity.qxwz" value="${entity.qxwz}" msg="缺陷位置必须输入。" />
						</td>

				</tr>
				<tr>
					<th width="16%" nowrap>
						<font color="red">*</font>&nbsp;发现日期：
					</th>
					<td >
						<input type="text" onclick="WdatePicker({el:$dp.$('entity.fxrq')})" readonly="true" name="entity.fxrq" datatype="Require" value='<fmt:formatDate value="${entity.fxrq}" pattern="yyyy-MM-dd HH:mm"/>' msg="发现日期必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.fxrq')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<th width="16%" >
						<font color="red">*</font>&nbsp;变电站：
					</th>
					<td nowrap>
						<input type="text" readonly="true" style="width:50%" datatype="Require" name="entity.bdzname" value="${entity.bdzname}" msg="变电站必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="选择变电站" onClick="javascript:getBdzjx('entity.bdz','entity.bdzname','entity.ouid')" />
					</td>
				</tr>
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;设备类型：
					</th>
					<td>
						<s:select list="sblxList" emptyOption="true"  name="entity.sblx" width="300" listKey="itemId" listValue="itemName" msg="设备类型必须输入。"/>
					</td>
					<th width="120" >
						<font color="red">*</font>&nbsp;设备间隔：
					</th>
					<td nowrap>
						<input type="text" style="width:50%"  name="entity.sbjg" value="${entity.sbjg}" msg="设备间隔必须输入。"/>
					</td>
				</tr>
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;缺陷内容：
					</th>
					<td colspan="3">
						<textarea  style="width:90%" datatype="LimitB" min="1"  max="500" rows="3" name="entity.qxnr" msg="缺陷内容必须输入并且最多输入250个汉字。">${entity.qxnr}</textarea>
					</td>
				</tr>
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;缺陷类别：
					</th>
					<td>
						<s:select list="qxlbList" emptyOption="true" datatype="Require" name="entity.qxlb" width="300" listKey="itemId" listValue="itemName" msg="缺陷类别必须输入。"/>
					</td>
					<th width="120" nowrap>
					</th>
					<td>
					</td>
				</tr>
			
				<tr>
				<th width="120" nowrap>
						<font color="red">*</font>缺陷照片：
					</th>
					<td>
						<c:if test="${entity.id != '0'}">
							<img style='cursor:pointer' onclick="filePopup('${entity.id}','TAB_SBQXJL-QXZP','1')" alt="打开图片列表" src="<%=contextPath%>/images/userfile.png" >
						</c:if>
						<c:if test="${entity.id == '0'}">
							&nbsp;<img style='cursor:pointer' src="<%=contextPath%>/images/redlight.gif"/><font color="red">请保存记录后上传缺陷照片</font>
						</c:if>
					</td>
					<th width="120" nowrap>
						&nbsp;发现人：
					</th>
					<td>
						<input type="text"  style="width:50%"  readonly="true"  name="entity.dyfxrname" value="${entity.dyfxrname}" msg="发现人必须输入。" />
						<c:if test="${entity.id != '0'}">
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.dyfxr','entity.dyfxrname','entity.bdz')" />
					</c:if>
					</td>
					
				</tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;消缺班组：
					</th>
					<td>
						<input type="text" style="width:50%" datatype="Require" readonly="true" name="entity.xqbzname" value="${entity.xqbzname}" msg="消缺班组必须输入。" />
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getBz('entity.xqbz','entity.xqbzname','entity.bdz')" />
					</td>
					<th width="120" nowrap>
						车间到位人员
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" maxlength="50" name="entity.dwryname" value="${entity.dwryname}" />
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.dwry','entity.dwryname','entity.bdz')" />
						
					</td>
				</tr>
					<th width="120" nowrap>
						班组到位人员
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" name="entity.ysrname" value="${entity.ysrname}" msg="班组到位人员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.ysr','entity.ysrname','entity.bdz')" />
					</td>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;配合班组：
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" name="entity.phbzname" value="${entity.phbzname}" msg="配合班组必须输入。" />
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.phbz','entity.phbzname','entity.bdz')" />
						</td>
				</tr>
				<tr>
					
					<th width="120" nowrap>
						计划消缺时间：
					</th>
					<td >
						<input onclick="WdatePicker({el:$dp.$('entity.jhxcsj')})" type="text" readonly="true" name="entity.jhxcsj" value='<fmt:formatDate value="${entity.jhxcsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="计划消缺时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.jhxcsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<th width="120" nowrap>
					计划消缺负责人：
					</th>
					<td>
						<input type="text" style="width:50%" maxlength="50" name="entity.hbrname" value="${entity.hbrname}" msg="计划消缺负责人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.hbr','entity.hbrname')" />
					
					</td>
				</tr>
				<tr>
					<th width="120" nowrap>
					计划消缺成员：
					</th>
					<td>
						<input type="text" style="width:50%" maxlength="50" name="entity.jsrname" value="${entity.jsrname}" msg="消除人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.jsr','entity.jsrname')" />
					
					</td>
					<th width="120" nowrap>
					计划消缺外用工人数：
					</th>
					<td>
						<input type="text" style="width:50%" maxlength="50" name="entity.wygrs" value="${entity.wygrs}" />
						
					</td>
				</tr>
					<tr>
					<th width="120" nowrap>
						未安排计划时间原因
					</th>
					<td colspan="3">
						<textarea  style="width:90%" datatype="LimitB" min="0"  max="500" rows="2" name="entity.xcyy" msg="消除原因必须输入并且最多输入250个汉字。">${entity.xcyy}</textarea>
					</td>
		
				</tr>
				<tr>
					
					<th width="120" nowrap>
						消除时间：
					</th>
					<td >
						<input onclick="WdatePicker({el:$dp.$('entity.xcsj')})" type="text" readonly="true" name="entity.xcsj" value='<fmt:formatDate value="${entity.xcsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="消除时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.xcsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<th width="120" nowrap>
						消缺负责人：
					</th>
					<td>
						<input type="text" style="width:50%" maxlength="50" name="entity.xcrname" value="${entity.xcrname}" msg="消除人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.xcr','entity.xcrname')" />
						
					</td>
				</tr>
			
				<tr>
					<th width="120" nowrap>
						消缺工作班成员
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" name="entity.xqcyname" value="${entity.xqcyname}" msg="消缺工作班成员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.xqcy','entity.xqcyname','entity.bdz')" />
					</td>
					<th width="120" nowrap>
					
					</th>
					<td>
						
					</td>
				</tr>
				<%if (session.getAttribute("btn_gzpj_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN"))) {%>
				<tr>
					<th width="120" nowrap>
						消缺情况
					</th>
					<td colspan="3">
						<input type="text" style="width:90%" name="entity.gzpj" value="${entity.gzpj}" maxlength="250"/>
					</td>
				</tr>
				<%}%>
				<% if ("0".equals(session.getAttribute("SESSION_ISADMIN"))) {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr" value="${entity.cjr}" msg="录入人员必须输入。"/>
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" name="entity.cjsj" readonly="true" value='<fmt:formatDate value="${entity.cjsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="录入时间必须输入。"/>
					</td>
				</tr>
				<%} else {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr" value="${entity.cjr}" msg="录入人员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.cjrid','entity.cjr','entity.bdz')" />
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" onclick="WdatePicker({el:$dp.$('entity.cjsj')})" name="entity.cjsj" readonly="true" value='<fmt:formatDate value="${entity.cjsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="录入时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.cjsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<%}%>
				<% if ("0".equals(session.getAttribute("SESSION_ISADMIN"))) {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid1"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr1" value="${entity.cjr1}" msg="录入人员必须输入。"/>
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" name="entity.cjsj1" readonly="true" value='<fmt:formatDate value="${entity.cjsj1}" pattern="yyyy-MM-dd HH:mm"/>' msg="录入时间必须输入。"/>
					</td>
				</tr>
				<%} else {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid1"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr1" value="${entity.cjr1}" msg="录入人员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.cjrid1','entity.cjr1','entity.bdz')" />
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" onclick="WdatePicker({el:$dp.$('entity.cjsj1')})" name="entity.cjsj1" readonly="true" value='<fmt:formatDate value="${entity.cjsj1}" pattern="yyyy-MM-dd HH:mm"/>' msg="录入时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.cjsj1')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<%}%>		
			</table>
		</form>
		</div>
	</body>
</html>
<script language="javascript">

	 // 保存
     function comt(){
     	//document.getElementById("entity.dwryname").value = document.getElementById("entity.dwry").options[document.getElementById("entity.dwry").selectedIndex].text;
     	document.frmM.action = "<%=contextPath%>/sbqxjl!save.do";
     	document.frmM.submit();
     }
     
     // 返回
     function back() {
     	document.frmM.action = "<%=contextPath%>/sbqxjlList!getList.do";
		document.frmM.submit();
     }
	 function pass(){

			  	/**if(!Validator.Validate(frmM,2)){
				  return false;
			  	}*/
			  	state=0;
			if ('${searchBean.con1}' == '0') {
				 state=1;           	
				 } else if('${searchBean.con1}' == '1') {
				        state=2;         		
				            	}	
			  	
  		document.frmM.action = "<%=contextPath%>/sbqxjl!history.do?state="+state;
     	document.frmM.submit();
		    }
		     function reject(){

			  	/**if(!Validator.Validate(frmM,2)){
				  return false;
			  	}*/
			  	state=0;
			if ('${searchBean.con1}' == '2') {
				 state=1;           	
				 } else if('${searchBean.con1}' == '1') {
				        state=0;         		
				        }	else{
				        return;
				        }	  	
  		document.frmM.action = "<%=contextPath%>/sbqxjl!reject.do?state="+state;
     	document.frmM.submit();
		    }
</script>